from typing import List

def bubble_sort(arr: List) -> List:
    for i in range(len(arr)-1):
        flag=1
        for j in range(len(arr)-i-1):
            if arr[j] > arr[j+1]:
                arr[j], arr[j+1] = arr[j+1],arr[j]
                # print("swap")
                flag = 0
        if flag == 1:
            break

if __name__ == '__main__':
    arr = [4,3,2,1]
    # arr.reverse()
    
    print(bubble_sort(arr))